/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package parser.part.n3;

import java.util.Arrays;
import java.util.HashMap;

/**
 *
 * @author Patronus
 */
interface Rule {

    public Object exequteRule();

    Object setParameterImport(int number_position, String ID);

    void setArgs(int position, Object value);

    Object[] getArgs();

    Object[][] getImport();
 




    boolean setReturnResult(boolean x);

    boolean getReturnResult();

}

abstract class Ruler implements Rule {

    protected String expression;
    protected HashMap results;
    protected String id;
    protected Object[] args;
    protected Object parameters_import[][];
    protected boolean needResult = true;
    protected String nextCondition;

    @Override
    public Object[][] getImport() {
        return this.parameters_import;
    }

    public Ruler(int arguments_count) {

        this.args = new Object[arguments_count];
        this.parameters_import = new Object[arguments_count][2];
        Arrays.fill(args, null);
        for (int i = 0; i < parameters_import.length; i++) {

            Arrays.fill(parameters_import[i], null);
        }
    }

    public Ruler() {
        this.args = new Object[16];
        this.parameters_import = new Object[16][1];
    }

    @Override
    public Object setParameterImport(int number_position, String ID) {
        if (parameters_import.length > number_position) {
            parameters_import[number_position][0] = ID;

        }
        return this;
    }

    @Override
    public void setArgs(int position, Object value) {

        if (args.length > position) {
            args[position] = value;
        }

    }

    @Override
    public Object[] getArgs() {
        return this.args;
    }


 
    @Override
    public boolean getReturnResult() {
        return this.needResult;
    }

    @Override
    public boolean setReturnResult(boolean x) {
        this.needResult = x;
        return this.needResult;
    }

}
